package com.laiyizhan.common.mapper;

import com.laiyizhan.common.model.Ninth_a;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Ninth_aMapper {

    @Select({
            "select",
            "*",
            "from Ninth_a",
            "where name = #{oName,jdbcType=VARCHAR}"
    })
    @ResultMap("BaseResultMap")
    List<Ninth_a> selectByName(String oName);
    @Delete({
            "delete from Ninth_a",
            "where name = #{oName,jdbcType=VARCHAR}"
    })
    int deleteByName(String oName);

    int insertBatch(List<Ninth_a> item);
    @Delete({
        "delete from eighth_a",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into eighth_a (name, type, ",
        "c_type, count)",
        "values (#{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, ",
        "#{cType,jdbcType=VARCHAR}, #{count,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(Ninth_a record);

    int insertSelective(Ninth_a record);

    @Select({
        "select",
        "id, name, type, c_type, count",
        "from eighth_a",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    Ninth_a selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Ninth_a record);

    @Update({
        "update eighth_a",
        "set name = #{name,jdbcType=VARCHAR},",
          "type = #{type,jdbcType=VARCHAR},",
          "c_type = #{cType,jdbcType=VARCHAR},",
          "count = #{count,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Ninth_a record);
}